package cn.hua.trip.base.domain;

import cn.hua.trip.base.util.JSONUtil;
import lombok.*;

import java.util.HashMap;

/**
 * 大攻略
 */

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Strategy extends BaseDomain {

    public static final int STATE_NOMAL = 1; //正常
    public static final int STATE_HOT = 2;  //推荐
    public static final int STATE_DISABLE = 3;  //禁用
    private Region place; //攻略所属的地区

    private String title; //标题

    private String subTitle;  //副标题

    private String coverUrl; //封面

    private Integer state = STATE_NOMAL; //默认正常

    public String getStateDisplay() {
        String temp = "";
        if (state == STATE_NOMAL) {
            temp = "正常";
        } else if (state == STATE_HOT) {
            temp = "推荐";
        } else if (state == STATE_DISABLE) {
            temp = "禁用";
        }
        return temp;
    }




    public String getJsonString(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",getId());
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        if (place!=null){
            map.put("placeId",place.getId());
        }
        return JSONUtil.toJSONString(map);
    }
}